//
//  NativeBleConnectStateChannel.m
//  kq_flutter_core_widget
//
//  Created by wtb on 2024/1/26.
//

#import "NativeBleConnectStateChannel.h"

@implementation NativeBleConnectStateChannel

#pragma mark 创建蓝牙连接通道对象
+(NativeBleConnectStateChannel *)registerStateWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar{
    FlutterEventChannel *stateChannel = [FlutterEventChannel eventChannelWithName:@"flutter.keqiang.com/bleConnectStateEvent" binaryMessenger:[registrar messenger]];
    NativeBleConnectStateChannel *state = [[NativeBleConnectStateChannel alloc] init];
    [stateChannel setStreamHandler:state];
    return state;
}

- (FlutterError * _Nullable)onCancelWithArguments:(id _Nullable)arguments {
    self.eventSink = nil;
    return nil;
}

- (FlutterError * _Nullable)onListenWithArguments:(id _Nullable)arguments eventSink:(nonnull FlutterEventSink)events { 
    self.eventSink = events;
    return nil;
}

@end
